﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BYSerial.Util
{
    public class EncodingNameTxt
    {
        public static string GetName(Encoding ed)
        {
            if(ed== Encoding.UTF8)
            {
                return "UTF-8";
            }
            else if (ed == Encoding.ASCII)
            {
                return "ASCII";
            }
            else if(ed== Encoding.GetEncoding("UTF-16"))
            {
                return "UTF-16";
            }
            else if (ed == Encoding.GetEncoding("UTF-32"))
            {
                return "UTF-32";
            }
            else if (ed == Encoding.GetEncoding("GB2312"))
            {
                return "GB2312";
            }
            else if (ed == Encoding.GetEncoding("GBK"))
            {
                return "GBK";
            }
            else if (ed == Encoding.GetEncoding("Big5"))
            {
                return "Big5";
            }
            else if (ed == Encoding.GetEncoding("ISO-8859-1"))
            {
                return "ISO-8859-1";
            }
            else if (ed == Encoding.GetEncoding("ISO-8859-15"))
            {
                return "ISO-8859-15";
            }
            else if (ed == Encoding.GetEncoding("Windows-1252"))
            {
                return "Windows-1252";
            }
            else if (ed == Encoding.GetEncoding("KOI8-R"))
            {
                return "KOI8-R";
            }
            else if (ed == Encoding.GetEncoding("KOI8-U"))
            {
                return "KOI8-U";
            }
            else if (ed == Encoding.GetEncoding("Shift_JIS"))
            {
                return "Shift_JIS";
            }
            else if (ed == Encoding.GetEncoding("EUC-JP"))
            {
                return "EUC-JP";
            }
            return "";
        }
    }
}
